package com.zysd.collection.scheduler.entity;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

/**
 * 任务模板与终端关联关系实体类
 *
 * @author liuht
 * @date 2017/10/13 9:32
 */
public class SchedulerTaskTerminalMapping implements Serializable {
    private Long id;

    private Long taskModelId;

    private Integer region;

    private Integer local;

    private Long terminalId;

    private String terminalName;

    private String ipAddr;

    private String ipPort;

    private Integer userId;

    private static final long serialVersionUID = 1L;

    public SchedulerTaskTerminalMapping(Long id, Long taskModelId, Integer region, Integer local, Long terminalId, String terminalName,
            String ipAddr, String ipPort, Integer userId) {
        this.id = id;
        this.taskModelId = taskModelId;
        this.region = region;
        this.local = local;
        this.terminalId = terminalId;
        this.terminalName = terminalName;
        this.ipAddr = ipAddr;
        this.ipPort = ipPort;
        this.userId = userId;
    }

    public SchedulerTaskTerminalMapping() {
        super();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getTaskModelId() {
        return taskModelId;
    }

    public void setTaskModelId(Long taskModelId) {
        this.taskModelId = taskModelId;
    }

    public Integer getRegion() {
        return region;
    }

    public void setRegion(Integer region) {
        this.region = region;
    }

    public Integer getLocal() {
        return local;
    }

    public void setLocal(Integer local) {
        this.local = local;
    }

    public Long getTerminalId() {
        return terminalId;
    }

    public void setTerminalId(Long terminalId) {
        this.terminalId = terminalId;
    }

    public String getTerminalName() {
        return terminalName;
    }

    public void setTerminalName(String terminalName) {
        this.terminalName = terminalName;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public String getIpPort() {
        return ipPort;
    }

    public void setIpPort(String ipPort) {
        this.ipPort = ipPort;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        SchedulerTaskTerminalMapping that = (SchedulerTaskTerminalMapping) o;

        return new EqualsBuilder()
                .append(id, that.id)
                .append(taskModelId, that.taskModelId)
                .append(region, that.region)
                .append(local, that.local)
                .append(terminalId, that.terminalId)
                .append(terminalName, that.terminalName)
                .append(ipAddr, that.ipAddr)
                .append(ipPort, that.ipPort)
                .append(userId, that.userId)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(taskModelId)
                .append(region)
                .append(local)
                .append(terminalId)
                .append(terminalName)
                .append(ipAddr)
                .append(ipPort)
                .append(userId)
                .toHashCode();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("taskModelId", taskModelId)
                .append("region", region)
                .append("local", local)
                .append("terminalId", terminalId)
                .append("terminalName", terminalName)
                .append("ipAddr", ipAddr)
                .append("ipPort", ipPort)
                .append("userId", userId)
                .toString();
    }
}
